<?php


namespace app\api\model;


class User extends BaseModel
{
    public function orders()
    {
        return $this->hasMany('Order', 'user_id', 'id');
    }

    public function address()
    {
        return $this->hasOne('UserAddress', 'user_id', 'id');
    }

    public static function getByOpenID($openid)
    {
        return self::where('openid', '=', $openid)->find();
    }

}